package com.example.myapplication.base;

/**
 * 接口请求异常类，处理不正常或未期望到的返回
 * <p>
 */

public class ApiException extends RuntimeException {

    private String msg;

    private String message;
    private int code;
    public String err;

    public ApiException(String message, int status) {
        super(message);

        this.msg = message;

        this.code = status;
    }

    public ApiException(Throwable cause) {
        super(cause);
    }

    public String getMsg() {
        if(msg!=null)return msg;
        if(err!=null) return err;
        return message;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getStatus() {
        return code;
    }

    public void setStatus(int status) {
        this.code = status;
    }
}
